export type DocumentType = 'code' | 'text';
export type InstructionTask = 'retrieval_query' | 'retrieval_document';

export class InstructionManager {

  /**
   * Generates an instruction for the embedding model.
   * @param task The task type (query or document retrieval).
   * @param type The document type (code or text).
   * @param text The text to be embedded (the query or document content).
   * @returns The formatted instruction string.
   */
  public static getInstruction(task: InstructionTask, type: DocumentType, text: string): string {
    let instruction = '';

    if (task === 'retrieval_query') {
      if (type === 'code') {
        instruction = 'Represent the programming question for retrieving relevant code snippets';
      } else {
        instruction = 'Represent the question for retrieving relevant text documents';
      }
    } else if (task === 'retrieval_document') {
      if (type === 'code') {
        instruction = 'Represent the code snippet for retrieval';
      } else {
        instruction = 'Represent the document for retrieval';
      }
    }

    // Format: "Instruction: {text}"
    return `${instruction}; Input: ${text}`;
  }
}
